<template>
  <div>
    <van-nav-bar class="ganavbar" title="案件审批" left-arrow @click-left="$router.go(-1)">
    </van-nav-bar>

    <div class="mainbody">
      <van-tabs v-model="activeTab">
        <van-tab title="待审">
          <van-pull-refresh v-model="db.refreshing" @refresh="getList(db, 1)" class="scroll-list withtab">
            <van-list v-model="db.loading" :finished="db.finished" finished-text="没有更多了" @load="getList(db)"
              class="listItems">
              <div class="item mdItem" v-for="(item, index) in db.list" :key="index" @click="showItemDetail(item)">
                <div class="title"><span style="color:#4de0e0;">[自然人]</span>高峰</div>
                <div class="kvs">
                  <div class="len"><div class="k">事项编号:</div><div class="v">0202341000</div></div>
                  <div class="len"><div class="k">审批状态:</div><div class="v">立案中</div></div>
                  <div class="len"><div class="k">地址:</div><div class="v">三里屯长江路123号个八大湾戈罗村13组5号</div></div>
                  <div class="len"><div class="k">电话:</div><div class="v">15913232421</div></div>
                  <div class="len"><div class="k">案件来源:</div><div class="v">自查发现</div></div>
                </div>
              </div>
            </van-list>
          </van-pull-refresh>
        </van-tab>
        <van-tab title="已审">
          <van-pull-refresh v-model="yb.refreshing" @refresh="getList(yb,1)" class="scroll-list withtab">
            <van-list v-model="yb.loading" :finished="yb.finished" finished-text="没有更多了" @load="getList(yb)"
              class="listItems">
              <div class="item mdItem" v-for="(item, index) in yb.list" :key="index" @click="showItemDetail(item)">
                <div class="title"><span style="color:#4de0e0;">[自然人]</span>高峰</div>
                <div class="kvs">
                  <div class="len"><div class="k">事项编号:</div><div class="v">0202341000</div></div>
                  <div class="len"><div class="k">审批状态:</div><div class="v">立案中</div></div>
                  <div class="len"><div class="k">地址:</div><div class="v">三里屯长江路123号个八大湾戈罗村13组5号</div></div>
                  <div class="len"><div class="k">电话:</div><div class="v">15913232421</div></div>
                  <div class="len"><div class="k">案件来源:</div><div class="v">自查发现</div></div>
                </div>
              </div>
            </van-list>
          </van-pull-refresh>
        </van-tab>
      </van-tabs>
    </div>

    <router-view class="routerview"/>
  </div>
</template>
<script>
export default {
  name: "JCRW",
  components: {
  },
  data () {
    return {
        activeTab: 0,
        db: {
          list: [],
          pagenum: 0,
          loading: false,
          finished: false,
          refreshing: false
        },
        yb: {
          list: [],
          pagenum: 0,
          loading: false,
          finished: false,
          refreshing: false
        }

    };
  },
  methods: {
    showItemDetail: function (item) {
      this.$router.push({name: 'AJSP_DETAIL', params: {item, mode: 'view'}});
    },
    getList (obj, pagenum = 0) {
      var vm = this;
      if (pagenum) {
        obj.pagenum = pagenum;
      } else {
        obj.pagenum++;
      }
      obj.refreshing = false;
      // 如果第一页起  
      if (obj.pagenum == 1) {
        obj.list = [];
        obj.finished = false;
      }
      obj.loading = true;
      var filterValue = '';
      vm.$getAndLoad('列表', 'getList.jsp?pagesize=10&pagenum=' + obj.pagenum + '&' + filterValue, function (data) {
        data.forEach(n => {
          obj.list.push(n);
        });
        if (data.length < 10) {
          obj.finished = true;
        }
        obj.loading = false;
      });
    }
  },
  mounted: function () {
  }
};
</script>

<style lang="scss" scoped>
</style>
